package pers.wensheng.patterns.structural_pattern.decorator_pattern;

import pers.wensheng.patterns.structural_pattern.decorator_pattern.decorator.Bacon;
import pers.wensheng.patterns.structural_pattern.decorator_pattern.decorator.Egg;
import pers.wensheng.patterns.structural_pattern.decorator_pattern.entity.*;

/**
 * 装饰者模式
 * 客户端测试类
 * 现在要加配料的话就在定义一个类就可以了
 *
 * 》》》》》》》》这个比较难理解要打断点调式一下就知道了《《《《《《《《《《
 */
public class Client {
    public static void main(String[] args) {
        //点一份炒饭
        FastFood food = new FriedRice();
        System.out.println("米饭价格："+food.cost());

        //在炒饭里面加一个鸡蛋
        food = new Egg(food);
        System.out.println("米饭价格："+food.cost());

//        //再加一个鸡蛋
//        food = new Egg(food);
//        System.out.println("米饭价格："+food.cost());

        //加一个培根
        food = new Bacon(food);
        System.out.println("米饭价格："+food.cost());
//
//
//        //加肉
//        food = new Meat(food);
//        System.out.println("米饭价格："+food.cost());
    }
}
